package com.ssy.lingxi.platform.manage.repository;

import com.ssy.lingxi.platform.manage.entity.base.Shop;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.io.Serializable;
import java.util.List;
import java.util.stream.Stream;

@Repository
public interface ShopRepository extends JpaRepository<Shop, Long> {

    List<Shop> findAllByStateEquals(Integer state);

    List<Shop> findByIdIn(List<Long> shopIdList);

    List<Shop> findAllByTypeEqualsAndStateEquals(Integer type, Integer state);

    List<Shop> findByTypeAndStateAndEnvironment(Integer type, Integer state, Integer environment);

    List<Shop> findAllByIdInAndTypeInAndEnvironmentAndState(List<Long> idList, List<Integer> typeList, Integer environment, Integer state);

    List<Shop> findByState(Integer stateStart);

    List<Shop> findAllByTypeAndState(Integer type, Integer state);

    List<Shop> findAllByTypeInAndState(List<Integer> types, Integer state);

    List<Shop> findAllByTypeAndEnvironmentAndPropertyAndState(Integer type, Integer environment, Integer property, Integer code, Sort sort);

    List<Shop> findAllByIdInAndEnvironmentAndState(List<Long> idList, Integer environment, Integer state);

    List<Shop> findByEnvironmentAndType(Integer environment, Integer type);

    List<Shop> findByEnvironmentAndTypeAndProperty(Integer environment, Integer type, Integer property);

    List<Shop> findByIdInAndState(List<Long> shopIdList, Integer state);

    List<Shop> findAllByIdInAndState(List<Long> collect, Integer code);

    List<Shop> findAllByIdInAndEnvironmentAndStateAndTypeIn(List<Long> shopId, Integer environment, Integer state, List<? extends Serializable> type);

    List<Shop> findByIdInAndStateAndSelf(List<Long> collect, Integer code, Integer self);
}
